ROS2 launch
Table of Content
ROS2 launch#
ROS2 launch file run/launch multiple nodes and allow to add logic to our startup sequence.
Launch file has many features to control the launch sequence
- Actions
- Event handlers
- substitutions
- conditions
Demo: Minimal launch file#
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
ld = LaunchDescription()
sim_node = Node(
package='turtlesim',
namespace='turtlesim1',
executable='turtlesim_node',
name='sim'
)
ld.add_action(sim_node)
return ld
copy launch folder#
cmake#
install(DIRECTORY
launch
DESTINATION share/${PROJECT_NAME}
)
python#
import os
from glob import glob
from setuptools import setup
package_name = 'py_launch_example'
setup(
# Other parameters ...
data_files=[
# ... Other data files
# Include all launch files.
(os.path.join('share', package_name, 'launch'), glob('launch/*launch.[pxy][yma]*'))
]
)